#include "lwheap_port.h"
#include "lwheap.h"

int main()
{
    lwheap_initial();
    printf("free size: %d\n", lwheap_get_freesize(&__heap));
    char* s0 = (char*)lw_malloc(30);
    printf("free size: %d\n", lwheap_get_freesize(&__heap));
    char* s1 = (char*)lw_malloc(20);
    printf("free size: %d\n", lwheap_get_freesize(&__heap));
    char* s2 = (char*)lw_malloc(50);
    printf("free size: %d\n", lwheap_get_freesize(&__heap));
    strcpy(s0, "Hello ");
    strcpy(s1, "world!");
    strcpy(s2, s0);
    strcat(s2, s1);
    strcat(s2, "\n");
    printf(s2);
    lw_free(s0);
    printf("free size: %d\n", lwheap_get_freesize(&__heap));
    lw_free(s1);
    printf("free size: %d\n", lwheap_get_freesize(&__heap));
    lw_free(s2);
    printf("free size: %d\n", lwheap_get_freesize(&__heap));
    return 0;
}
